package com.example.shop.pojo;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Getter;
import lombok.Setter;
import lombok.experimental.Accessors;

/**
 * <p>
 * 商品类型
 * </p>
 *
 * @author 作者
 * @since 2022-05-29
 */
@Accessors(chain = true)
@TableName("goods_type")
public enum GoodsType {

    FOOD("食品"),
    NUMERICAL_CODE("数码"),
    CLOTHES("衣服"),
    CELLPHONE("手机")
    ;
    private static final long serialVersionUID = 1L;

    //商品的类型
    private String goodsType;

    GoodsType(String typeName){
        this.goodsType = typeName;
    }

    public static GoodsType getGoodsType(String typeName){
        try{
            return GoodsType.valueOf(typeName);
        }catch (Exception e){
            return null;
        }
    }

    public String getTypeName(){
        return goodsType;
    }


    @Override
    public String toString() {
        return this.name();
    }
}
